﻿module Sustainalytics.Portfolio {

    import Common = Sustainalytics.Common;
    import SearchBox = Sustainalytics.SearchBox;

    
    export class PortfoliosAndUniversesSearchBoxServiceAdapter  {

        private portfolioSearchService: PortfolioSearchService;
        private _idAccount: string;
     
        public portfoliosPromiseDtos: PortfolioDto[] = null;

        public constructor(
            private $http: ng.IHttpService,
            private $rootScope: ng.IScope,
            private $q: ng.IQService) {

            this.portfolioSearchService = new Sustainalytics.Portfolio.PortfolioSearchService($http, $rootScope, $q);
            this._idAccount = $rootScope['userInfo'].accountId;
        }

       public Search(searchData: any, skip: number, take: number): ng.IHttpPromise<PortfolioUniverseMixDto[]> {        
                                    
         var portfoliosUniversesMixed: ng.IHttpPromise<PortfolioUniverseMixDto[]>  = this.portfolioSearchService.SearchScreeningToolPortfoliosAndUniversesMix(searchData, skip, take);

         return portfoliosUniversesMixed;
        }
    }
       
    var mod = angular.module(portfolioModuleName);

    mod.service('PortfoliosAndUniversesSearchBoxServiceAdapter',
        ['$http', '$rootScope', '$q', PortfoliosAndUniversesSearchBoxServiceAdapter]);
} 